@layout("/common/_container.html"){
<div class="ibox float-e-margins">
    <div class="ibox-content">
        <div class="form-horizontal">

            <input type="hidden" id="id" value="">
 			<input type="hidden" id="themeImage" value=""> 
 
			<div class="row">
                <div class="col-sm-6">
                            <#input id="seq" name="排序" underline="true"/>
                            <#avatar id="imageSrc" name="图片" underline="true"/>
                            
                            <div class="form-group layui-upload">
							  <button type="button" class="layui-btn" id="test2">主题图片上传</button> 
							  <blockquote  style="margin-top: 10px;">
							      预览图：
							    <div class="layui-upload-list" id="imageThumbnail" >
							    </div>
							 </blockquote>
							</div>
                            
                            <div class="form-group">
						    <label class="col-sm-3 control-label">跳转类型</label>
						    <div class="col-sm-9">
						    	 <input type="radio" id="jumpType" name="jumpType" value="1" />详情页
	                             <input type="radio" id="jumpType" name="jumpType" value="2" />小程序
	                             <input type="radio" id="jumpType" name="jumpType" value="3" />H5页面
						    </div>
						    </div>  
						    <div class="hr-line-dashed"></div>
						    
                            <#input id="appId" name="appId"/>
                </div>

                <div class="col-sm-6">
                            <#input id="title" name="标题" underline="true"/>
                            <#input id="description" name="描述" underline="true"/>
                            <#input id="appUrl" name="小程序地址" underline="true"/>
                            <#input id="h5Url" name="h5地址" underline="true"/>
                </div>
                <div class="form-group">
                        <div class="col-sm-11">
                            <div id="detail" class="editorHeight">
                            </div>
                        </div>
                    </div>
            </div>
            <div class="row btn-group-m-t">
                <div class="col-sm-10">
                    <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="HotListInfoDlg.addSubmit()"/>
                    <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="HotListInfoDlg.close()"/>
                </div>
            </div>
        </div>

    </div>
</div>

<script type="text/javascript" src="//unpkg.com/wangeditor/release/wangEditor.min.js"></script>
<script src="${ctxPath}/static/modular/app/hotList/hotList_info.js"></script>
<script src="${ctxPath}/static/js/plugins/layui/layui.js"></script>
<link rel="stylesheet" href="${ctxPath}/static/js/plugins/layui/css/layui.css"  media="all">

<script> 

var htmlArray=new Array();
layui.use('upload', function(){
	  var url = Feng.ctxPath + '/mgr/uploadMulti';
	  var $ = layui.jquery
	  ,upload = layui.upload; 
	  
	  //多图片上传
	  upload.render({
	    elem: '#test2'
	    ,url: url
	    ,multiple: true
	    ,before: function(obj){ 
	      //预读本地文件示例，不支持ie8
	      obj.preview(function(index, file, result){ 
	    	  var i = index.substr(index.indexOf('-')+1);
	    	  htmlArray[i]='<div class="report-name" style="margin-left:0px;" > <img src="'+ result +'" alt="'+ file.name +'" style="width:92px;height:92px;margin:0 10px 10px 0;"> <a href=\'javascript:void(0)\' onclick="deleteImgae(this)"  alt="删除"  type=\'button\'> <div class="deletImage">x</div>';
	      });
	    }
	    ,done: function(res){ 
	    	debugger
	    	$.each(htmlArray, function(i,val){        
	    		var html = htmlArray[i];
	    		html+='<input type="hidden" name="imageHidden" value="'+res.data.image+'"> </a> </div>';
	    		$('#imageThumbnail').append(html);
	        });     
	    	htmlArray=new Array();
	    	var themeImage = $("#themeImage").val();
	    	debugger
	    	if(themeImage ==null || themeImage==''){
	    		$("#themeImage").val(res.data.image);
	    	}else{
	    		$("#themeImage").val(themeImage+","+res.data.image);
	    	} 
	      //上传完毕
	    }
	  });
	   
	});
	 
  function deleteImgae(obj){
	  debugger;
	  var imagePath='';
	  var path = $(obj).find("input[name='imageHidden']").val();
      $(obj).parent().remove(); 
      var themeImage =  $("#themeImage").val();
      var themeImageArr = themeImage.split(",");
  	  $.each(themeImageArr, function(i,val){        
		var htmlval = themeImageArr[i];
		 if(path != htmlval){
	    	if(imagePath ==null || imagePath==''){
	    		imagePath+= htmlval;
	    	}else{
	    		imagePath+= ","+htmlval;
	    		
	    	} 
		 }
      }); 
  	$("#themeImage").val(imagePath);
      
  }
</script> 
@}
